#ifndef _DSWPARAM_H
#define _DSWPARAM_H
#include <libbase/dswbase.h>
#include <libdswparam/default_param.h>
#include "appver.h"

class CDswparam : public CDswbase
{
public:
	CDswparam(LPST_ENV_T pEnv);
	virtual ~CDswparam();
private:
	void LoadParam(bool bLoadDefault);
	void SaveParam();
	void MakeOsVer(char* pBuffer);
	bool CheckIsInPlans(time_t nNow, LPLIST_PLAN_T pPlanList);
	EN_LOCK_TYPE GetCurrentAutoLockType(time_t nNow, LPLIST_PLAN_T pPlanList);
protected:
	virtual int OnMessage(EN_MSG_TYPE nMsgType, void* pParam);
public:
	static void cbProcessSubDoc_Get(void* pArg, CDswparam* pParam){pParam->ProcessSubDoc_Get((CMarkup*)pArg);};
	static void cbProcessBaseTag_Get(void* pArg, CDswparam* pParam){pParam->ProcessBaseTag_Get((CMarkup*)pArg);};
	static void cbProcessNetTag_Get(void* pArg, CDswparam* pParam){pParam->ProcessNetTag_Get((CMarkup*)pArg);};
	static void cbProcessVideoTag_Get(void* pArg, CDswparam* pParam){pParam->ProcessVideoTag_Get((CMarkup*)pArg);};
	static void cbProcessAudioTag_Get(void* pArg, CDswparam* pParam){pParam->ProcessAudioTag_Get((CMarkup*)pArg);};
	static void cbProcessAlarmTag_Get(void* pArg, CDswparam* pParam){pParam->ProcessAlarmTag_Get((CMarkup*)pArg);};
	static void cbProcessAutoPlansTag_Get(void* pArg, CDswparam* pParam){pParam->ProcessAutoPlansTag_Get((CMarkup*)pArg);};
	static void cbProcessRecPlansTag_Get(void* pArg, CDswparam* pParam){pParam->ProcessRecPlansTag_Get((CMarkup*)pArg);};
	static void cbProcessLocationTag_Get(void* pArg, CDswparam* pParam){pParam->ProcessLocationTag_Get((CMarkup*)pArg);};
	static void cbProcessAspusrTag_Get(void* pArg, CDswparam* pParam){pParam->ProcessAspusrTag_Get((CMarkup*)pArg);};
	static void cbProcessSystimeTag_Get(void* pArg, CDswparam* pParam){pParam->ProcessSystimeTag_Get((CMarkup*)pArg);};
	static void cbProcessPtzAddTag_Get(void* pArg, CDswparam* pParam){pParam->ProcessPtzAddTag_Get((CMarkup*)pArg);};
	static void cbProcessLdCamTag_Get(void* pArg, CDswparam* pParam){pParam->ProcessLdCamTag_Get((CMarkup*)pArg);};
	static void cbProcessOnvifTag_Get(void* pArg, CDswparam* pParam){pParam->ProcessOnvifTag_Get((CMarkup*)pArg);};

	static void cbProcessBaseTag_Set(void* pParam, CDswparam* pCaller, char* pStrXML, CMarkup &xml){pCaller->ProcessBaseTag_Set(pParam, pStrXML, xml);};
	static void cbProcessEthTag_Set(void* pParam, CDswparam* pCaller, char* pStrXML, CMarkup &xml){pCaller->ProcessEthTag_Set(pParam, pStrXML, xml);};
	static void cbProcessDNSTag_Set(void* pParam, CDswparam* pCaller, char* pStrXML, CMarkup &xml){pCaller->ProcessDNSTag_Set(pParam, pStrXML, xml);};
	static void cbProcessVideoTag_Set(void* pParam, CDswparam* pCaller, char* pStrXML, CMarkup &xml){pCaller->ProcessVideoTag_Set(pParam, pStrXML, xml);};
	static void cbProcessAudioTag_Set(void* pParam, CDswparam* pCaller, char* pStrXML, CMarkup &xml){pCaller->ProcessAudioTag_Set(pParam, pStrXML, xml);};
	static void cbProcessAlarmTag_Set(void* pParam, CDswparam* pCaller, char* pStrXML, CMarkup &xml){pCaller->ProcessAlarmTag_Set(pParam, pStrXML, xml);};
	static void cbProcessAutoPlansTag_Set(void* pParam, CDswparam* pCaller, char* pStrXML, CMarkup &xml){pCaller->ProcessAutoPlansTag_Set(pParam, pStrXML, xml);};
	static void cbProcessRecPlansTag_Set(void* pParam, CDswparam* pCaller, char* pStrXML, CMarkup &xml){pCaller->ProcessRecPlansTag_Set(pParam, pStrXML, xml);};
	static void cbProcessLocationTag_Set(void* pParam, CDswparam* pCaller, char* pStrXML, CMarkup &xml){pCaller->ProcessLocationTag_Set(pParam, pStrXML, xml);};
	static void cbProcessAspusrTag_Set(void* pParam, CDswparam* pCaller, char* pStrXML, CMarkup &xml){pCaller->ProcessAspusrTag_Set(pParam, pStrXML, xml);};
	static void cbProcessSystimeTag_Set(void* pParam, CDswparam* pCaller, char* pStrXML, CMarkup &xml){pCaller->ProcessSystimeTag_Set(pParam, pStrXML, xml);};
	static void cbProcessPtzAddTag_Set(void* pParam, CDswparam* pCaller, char* pStrXML, CMarkup &xml){pCaller->ProcessPtzAddTag_Set(pParam, pStrXML, xml);};
	static void cbProcessLdCamTag_Set(void* pParam, CDswparam* pCaller, char* pStrXML, CMarkup &xml){pCaller->ProcessLdCamTag_Set(pParam, pStrXML, xml);};
	static void cbProcessOnvifTag_Set(void* pParam, CDswparam* pCaller, char* pStrXML, CMarkup &xml){pCaller->ProcessOnvifTag_Set(pParam, pStrXML, xml);};
private:
	void ProcessSubDoc_Get(CMarkup* pXml);
	void ProcessBaseTag_Get(CMarkup* pXml);
	void ProcessNetTag_Get(CMarkup* pXml);
	void ProcessVideoTag_Get(CMarkup* pXml);
	void ProcessAudioTag_Get(CMarkup* pXml);
	void ProcessAlarmTag_Get(CMarkup* pXml);
	void ProcessAutoPlansTag_Get(CMarkup* pXml);
	void ProcessRecPlansTag_Get(CMarkup* pXml);
	void ProcessLocationTag_Get(CMarkup* pXml);
	void ProcessAspusrTag_Get(CMarkup* pXml);
	void ProcessSystimeTag_Get(CMarkup* pXml);
	void ProcessPtzAddTag_Get(CMarkup* pXml);
	void ProcessLdCamTag_Get(CMarkup* pXml);
	void ProcessOnvifTag_Get(CMarkup* pXml);

	void ProcessBaseTag_Set(void* pParam, char* pStrXML, CMarkup &xml);
	void ProcessEthTag_Set(void* pParam, char* pStrXML, CMarkup &xml);
	void ProcessDNSTag_Set(void* pParam, char* pStrXML, CMarkup &xml);
	void ProcessVideoTag_Set(void* pParam, char* pStrXML, CMarkup &xml);
	void ProcessAudioTag_Set(void* pParam, char* pStrXML, CMarkup &xml);
	void ProcessAlarmTag_Set(void* pParam, char* pStrXML, CMarkup &xml);
	void ProcessAutoPlansTag_Set(void* pParam, char* pStrXML, CMarkup &xml);
	void ProcessRecPlansTag_Set(void* pParam, char* pStrXML, CMarkup &xml);
	void ProcessLocationTag_Set(void* pParam, char* pStrXML, CMarkup &xml);
	void ProcessAspusrTag_Set(void* pParam, char* pStrXML, CMarkup &xml);
	void ProcessSystimeTag_Set(void* pParam, char* pStrXML, CMarkup &xml);
	void ProcessPtzAddTag_Set(void* pParam, char* pStrXML, CMarkup &xml);
	void ProcessLdCamTag_Set(void* pParam, char* pStrXML, CMarkup &xml);
	void ProcessOnvifTag_Set(void* pParam, char* pStrXML, CMarkup &xml);
private:
	void SetDefaultParam(CMarkup* pXml);
private:
	pthread_mutex_t m_nLock;
	ST_DEV_PARAM_T m_nParam;
	time_t m_nModifyTime;
};

#endif

